//package com.liuyu.common.framework.drools;
//
//import org.apache.poi.ss.formula.functions.Address;
//import org.drools.core.io.impl.UrlResource;
//import org.kie.api.KieServices;
//import org.kie.api.builder.KieModule;
//import org.kie.api.builder.KieRepository;
//import org.kie.api.runtime.KieContainer;
//import org.kie.api.runtime.KieSession;
//
//import java.io.IOException;
//import java.io.InputStream;
//
///**
// *
// * @author: liuyu
// * @date: 2021/11/2 16:25
// * @version:
// */
//public class DroolsServiceTest {
//    public static void main(String[] args) {
//        String url = "http://56.101.238.145:8087/business-central/maven2/com/liuyu/harper/1.0.0/harper-1.0.0.jar";
//        KieServices kieServices = KieServices.Factory.get();
//        KieRepository kieRepository = kieServices.getRepository();
//        UrlResource resource = (UrlResource) kieServices.getResources().newUrlResource(url);
//        resource.setBasicAuthentication("enabled");
//        resource.setPassword("admin");
//        resource.setUsername("admin");
//        InputStream is = null;
//        try {
//            is = resource.getInputStream();
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
//        KieModule kieModule = kieRepository.addKieModule(kieServices.getResources().newInputStreamResource(is));
//        KieContainer kieContainer = kieServices.newKieContainer(kieModule.getReleaseId());
////        KieSession kieSession = kieContainer.newKieSession();
//        KieSession kieSession = kieContainer.newKieSession("ksessionId");
//        ApplyInfo applyInfo = new ApplyInfo();
//        applyInfo.setAge("19");
//        applyInfo.setName("hello");
//        Address address = new Address();
//        address.setProvince("aa");
//        applyInfo.setFamilyAddress(address);
//
//        kieSession.insert(applyInfo);
//        kieSession.fireAllRules();
//    }
//}
